package com.home.fitzx.web.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.alibaba.fastjson.JSONObject;
import com.home.fitzx.entity.User;
import com.home.fitzy.service.FitzyService;

@Controller
@RequestMapping("/test")
public class TestController {

	@Autowired
	private FitzyService fitzyService;
	
	@RequestMapping("/t1")
	@ResponseBody
	public User test() {
		User user = new User();
		user.setName("allen");
		user.setAge(23);
		return user;
	}
	
	@RequestMapping("/t12")
	@ResponseBody
	public JSONObject test2() {
		JSONObject json = new JSONObject();
		json.put("name", "fitz");
		json.put("age", 22);
		return json;
	}
	
	@RequestMapping("/hello")
	@ResponseBody
	public JSONObject hello(String name) {
		JSONObject json = new JSONObject();
		json.put("msg", fitzyService.sayHi(name));
		return json;
	}
}
